<template>
  <div>
    <pre v-if="fileContent">{{ fileContent }}</pre>
  </div>
</template>

<script setup>
import { ref, onMounted } from 'vue';

const fileContent = ref('');

const loadRemoteFile = async () => {
  try {
    const response = await fetch('http://localhost:9090/file/download/maiin.txt');
    if (response.ok) {
      const text = await response.text();
      fileContent.value = text;
    } else {
      console.error('文件加载失败:', response.status);
    }
  } catch (error) {
    console.error('发生错误:', error);
  }
};

onMounted(() => {
  loadRemoteFile();
});
</script>